
<!--_meta 作为公共模版分离出去-->
{include file="public/_meta"}

<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-member-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>头 像：</label>
			<div class="formControls col-xs-7 col-sm-8 skin-minimal">
				<div id="upBox">
					<div id="inputBox" class="inputBox btn btn-primary radius">
						<input class="user_images" name="user_images" type="file" value="{$user.user_images}" title="请选择图片" id="file" />点击选择图片
					</div>
					<div id="imgBox" style="position: relative">
						{if condition="$user.user_images eq null"}
						{else/}
						<div>
							<img onclick="imgDisplay(this)" class="tag_img imgContainer" style="cursor:pointer;width: 100px;height: 100px;"  src="__PUBLIC__{$user.user_images}"/>
						</div>
						{/if}
					</div>
				</div>
			</div>
		</div>
		<div class="row cl">
			<input type="hidden" class="input-text" value="{$user['id']}" placeholder="" id="user_id" name="id">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<input type="text" class="input-text" value="{$user['username']}" placeholder="" id="username" name="username">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>姓名：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<input type="text" class="input-text" value="{$user['full_name']}" placeholder="" id="full_name" name="full_name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<input type="text" class="input-text" value="{$user['tel']}" placeholder="" id="tel" name="tel">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>昵称：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<input type="text" class="input-text" value="{$user['nickname']}" placeholder="" id="nickname" name="nickname">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>性别：</label>
			<div class="formControls col-xs-7 col-sm-8 skin-minimal">
				<span class="select-box">
					<select id="sex" name="sex" class="select">
						{if condition = "$user['sex'] eq '0'"}
							<option value="">请选择</option>
							<option value="0" selected>男</option>
							<option value="1">女</option>
						{else/}
							<option value="">请选择</option>
							<option value="0" >男</option>
							<option value="1" selected>女</option>
						{/if}
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>年龄：</label>
			<div class="formControls col-xs-7 col-sm-8">
				<input type="text" class="input-text" value="{$user['age']}" placeholder="" id="age" name="age">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户权限：</label>
			<div class="formControls col-xs-7 col-sm-8 skin-minimal">
				<span class="select-box">
					<select id="user_auth" name="user_auth" class="select">
						{volist name="user_auth" id="vo"}
						{if condition="$vo.id eq $user.user_auth"}
						<option value="{$vo.id}" selected="selected">{$vo.title}</option>
						{else/}
						<option value="{$vo.id}">{$vo.title}</option>
						{/if}
						{/volist}
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>推荐人：</label>
			<div class="formControls col-xs-8 col-sm-8">
				<select class="js-example-basic-single select" name="rec_id" >
					{volist name="users" id="vo"}
					<option value="{$vo.id}" {if condition="$vo.id eq $user['rec_id']"}selected="selected"{/if} >{$vo.full_name}=={$vo.tel}</option>
					{/volist}
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>总推荐人：</label>
			<div class="formControls col-xs-8 col-sm-8">
				<select class="js-example-basic-single select" name="total_rec_id" >
					{volist name="users" id="vo"}
					<option value="{$vo.id}" {if condition="$vo.id eq $user['total_rec_id']"}selected="selected"{/if} >{$vo.full_name}=={$vo.tel}</option>
					{/volist}
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>省级推荐人：</label>
			<div class="formControls col-xs-8 col-sm-8">
				<select class="js-example-basic-single select" name="province_rec_id" >
					{volist name="users" id="vo"}
					<option value="{$vo.id}" {if condition="$vo.id eq $user['province_rec_id']"}selected="selected"{/if} >{$vo.full_name}=={$vo.tel}</option>
					{/volist}
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>市级推荐人：</label>
			<div class="formControls col-xs-8 col-sm-8">
				<select class="js-example-basic-single select" name="city_rec_id" >
					{volist name="users" id="vo"}
					<option value="{$vo.id}" {if condition="$vo.id eq $user['city_rec_id']"}selected="selected"{/if} >{$vo.full_name}=={$vo.tel}</option>
					{/volist}
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>区级推荐人：</label>
			<div class="formControls col-xs-8 col-sm-8">
				<select class="js-example-basic-single select" name="area_rec_id" >
					{volist name="users" id="vo"}
					<option value="{$vo.id}" {if condition="$vo.id eq $user['area_rec_id']"}selected="selected"{/if} >{$vo.full_name}=={$vo.tel}</option>
					{/volist}
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>校级推荐人：</label>
			<div class="formControls col-xs-8 col-sm-8">
				<select class="js-example-basic-single select" name="school_rec_id" >
					{volist name="users" id="vo"}
					<option value="{$vo.id}" {if condition="$vo.id eq $user['school_rec_id']"}selected="selected"{/if} >{$vo.full_name}=={$vo.tel}</option>
					{/volist}
				</select>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-7 col-sm-8 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="提交">
				<button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn6 size-M radius" type="button">取消</button>
			</div>
		</div>
	</form>
</article>


<!--_footer 作为公共模版分离出去-->
{include file="public/_footer"}

<script type="text/javascript">
    imgUpload({
        inputId:'file', //input框id
        imgBox:'imgBox' //图片容器id
    });

    $(function(){
        $(".user_images").change(function() {
            $('.tag_img').attr('class','display_none');
        });
    });

	/*下拉查询选择*/
	$(document).ready(function() {
		$('.js-example-basic-single').select2();
	});
</script>

<script type="text/javascript">

	//ajax会员修改
	$(function(){
		$('.skin-minimal input').iCheck({
			checkboxClass: 'icheckbox-blue',
			radioClass: 'iradio-blue',
			increaseArea: '20%'
		});

		/*编辑-用户*/
		$("#form-member-add").validate({
			onkeyup:false,
			focusCleanup:true,
			success:"valid",
			submitHandler:function(form){
				var data = $(form).serializeArray();
				$(form).ajaxSubmit({
					type: 'post',
					url: "{:url('member/edit_member')}",
					dataType: 'json',
					data: data,
					success: function(msg){
						if(msg.status == true){
							layer.msg(msg.message,{icon: 6,time:1000});
							setTimeout(jump,1000);
							function jump(){
								parent.location.reload();
							}
						}else if(msg.status == false){
							layer.msg(msg.message,{icon: 5,time:2000});
						}
					}
				});
				//var index = parent.layer.getFrameIndex(window.name);
				//parent.$('.btn-refresh').click();
				//parent.layer.close(index);
			}
		});
	});
</script> 
<!--/请在上方写此页面业务相关的脚本-->